#define THIS_FILE "diriger.sqf"
#include <base\tmf_constants.h>
#include <base\tmf_macros.h>
WAITINIT(diriger);

// ["C_man_1_1_F","marker1","marker2"] execVM "liberer.sqf";
if (!isServer) exitWith {};
private ["_type","_marker","_dest_marker","_error","_dest_msg","_dead_msg","_tmf_params","_obj_params"];
DEFAULT_PARAM(_type,0,"");
DEFAULT_PARAM(_marker,1,"");
DEFAULT_PARAM(_dest_marker,2,"");
DEFAULT_PARAM(_dest_msg,3,ARR_1("STR_TYR_TARGET_LEAD"));
DEFAULT_PARAM(_dead_msg,4,ARR_1("STR_TYR_TARGET_DIED"));

_error = false;
if (IS_STRING(_type)) then { _error = (_type == "") };
if (IS_STRING(_marker)) then { _error = (_marker == "") };
if (_error) exitWith {};

_obj_params = [];
_obj_params set [TMF_VEH_PARAMS_TYPE, _type];
_obj_params set [TMF_VEH_PARAMS_GRP, GVAR(own_side)];
_obj_params set [TMF_VEH_PARAMS_POS, _marker];

_tmf_params = [];
_tmf_params = [_tmf_params,"DEST_MSG",_dest_msg] call CFUNC(hashSet);
_tmf_params = [_tmf_params,"DIE_MSG",_dead_msg] call CFUNC(hashSet);
// _tmf_params = [_tmf_params,"SHARED_DEST_VAR",""] call CFUNC(hashSet);
// _tmf_params = [_tmf_params,"SHARED_ALIVE_VAR",""] call CFUNC(hashSet);
_tmf_params = [_tmf_params,"DESTINATION",[_dest_marker]] call CFUNC(hashSet);
// _tmf_params = [_tmf_params,"DEST_CODE",""] call CFUNC(hashSet);
// _tmf_params = [_tmf_params,"DIE_CODE",""] call CFUNC(hashSet);

OBJ = [_obj_params,"LEAD",_tmf_params] call FFUNC(CreateMissionUnit);
